package common.effect.club
{
	import com.common.utils.Reflection;
	import com.global.GlobalDef;
	
	import common.effect.EffectView;
	import common.effect.IEffectView;
	
	import flash.events.Event;
	
	import lz.controls.managers.AnimationManager;

	/**
	 *俱乐部升级动画 
	 * @author lake
	 * 
	 */	
	public class ClubUpgradeEffectView extends EffectView implements IEffectView
	{
		public function ClubUpgradeEffectView()
		{
			super();
		}
		/**
		 *初始化 
		 * @param view
		 */		
		override public function initUI(view:Object=null):void
		{
			_symbolSkin = Reflection.createInstance("com.lz.fb.effect.ClubGradeSkin");
			if(_symbolSkin)
			{
				this.addChild(_symbolSkin);
				_symbolSkin.x = GlobalDef.GameStage.stageWidth/2;
				_symbolSkin.y = GlobalDef.GameStage.stageHeight/3;
				_symbolSkin.addEventListener(Event.REMOVED_FROM_STAGE,onRemoveFromStage);
			}
			else
			{
				destroy();
			}
		}
		/**
		 *移除 
		 * @param e
		 * 
		 */		
		private function onRemoveFromStage(e :Event):void
		{
			destroy();
		}
		/**
		 *销毁 
		 */		
		override public function destroy():void
		{
			AnimationManager.remove();
			if(_symbolSkin)
			{
				_symbolSkin.removeEventListener(Event.REMOVED_FROM_STAGE,onRemoveFromStage);
			}
			if(this.parent)
			{
				this.parent.removeChild(this);
			}
		}
	}
}